//
//  URLExtension.swift
//  JKTools
//
//  Created by 姜奎 on 2024/4/25.
//

import Foundation

extension URL {
    func currentDirectory() throws -> URL {
        let resourceValues = try self.resourceValues(forKeys: [.isDirectoryKey])
        if resourceValues.isDirectory == true {
            return self
        }
        return self.deletingLastPathComponent()
    }
}

